import { http } from '@/utils/http'
import type { LoginResult } from '@/types/member'

type loginParams = {
  code: string
  encryptedData: string
  iv: string
}
/**
 * 小程序登录接口
 * @param data 登录接口传参
 * @returns
 */
export const postLoginWxMinAPI = (data: loginParams) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

export type loginWxMinSimpleParams = {
  /**
   * 不传加密信息时，模拟的手机号必传
   */
  phoneNumber: string
}
// 小程序登录内测接口
export const loginWxMinSimpleAPI = (data: loginWxMinSimpleParams) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin/simple',
    data,
  })
}
